---
layout: "default"
title: "reduce"
description: "Swift documentation for 'reduce': Return the result of repeatedly calling combine with an."
keywords: "reduce,func,swift,documentation"
root: "/v1.2"
---

<div class="declaration" id="func-reduce-s_-sequencetype-u_-s-initial_-u-combine_-noescape-u-s-generator-element-u">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-reduce-s_-sequencetype-u_-s-initial_-u-combine_-noescape-u-s-generator-element-u">func <wbr>reduce&lt;S : SequenceType, U&gt;(<wbr>_:<wbr> S, initial:<wbr> U, combine: @noescape (U, S.Generator.Element) -&gt; U)</a>
        
<div class="comment collapse" id="comment-func-reduce-s_-sequencetype-u_-s-initial_-u-combine_-noescape-u-s-generator-element-u"><div class="p">
    <p>Return the result of repeatedly calling <code>combine</code> with an
accumulated value initialized to <code>initial</code> and each element of
<code>sequence</code>, in turn.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func reduce&lt;S : SequenceType, U&gt;(sequence: S, initial: U, combine: @noescape (U, S.Generator.Element) -&gt; U) -&gt; U</code>
    
    
</div></div>
</div>
